﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NLBS.Data;
using NLBS.Framework;
using NLBS.Web;
using System.IO;
using NLBS.Utility;


namespace NLBS
{
    public partial class Templete : System.Web.UI.MasterPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            GZipHelper.GZipEncodePage();

            SetSkin();

            this.Page.ClientScript.RegisterHiddenField("stats", Request.IsAuthenticated.ToString());
            Page.Title = BlogInfo.Instance().Title;
            feed.Attributes["title"] = Page.Title;
        }

        private void SetSkin()
        {
            if (Request.Cookies[StateKey.SkinCookieKey] != null)
            {
                skin.Href = RequestWrapper.ApplicationPath + Request.Cookies[StateKey.SkinCookieKey].Value;
            }
            else
            {
                skin.Href = RequestWrapper.ApplicationPath + BlogInfo.Instance().SkinPath;
            }

            if (Request.QueryString["preview"] != null)
            {
                skin.Href = "/styles/" + Request.QueryString["preview"] + "/styles.css";
            }
        }
    }
}
